class Keyword #:nodoc:
  include MongoMapper::Document
  
  key :name, String
  key :last_tweet_id, Integer
  key :created_on, Time

  validates_presence_of :name
  
  belongs_to :account
  
  before_save :set_defaults
  
  def set_defaults
    if self.created_on == nil
      self.created_on = Time.now
    end
    
    if self.last_tweet_id == nil
      self.last_tweet_id = 0
    end
  end
  def to_s
    return self.to_yaml
  end
end